package electricity.Enum;


//工单状态枚举类
public enum RepairStatusEnum {
    PENDING(1, "待办"),
    PROCESSING(2, "处理中"),
    COMPLETED(3, "已处理"),
    FAILED(4, "处理失败");

    private Integer code;
    private String desc;

    RepairStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    // Getters
    public Integer getCode() { return code; }
    public String getDesc() { return desc; }
    // 自定义 valueOf 方法：通过 code 获取枚举
    public static RepairStatusEnum valueOf(Integer code) {
        if (code == null) {
            return null;
        }
        for (RepairStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("No matching RepairStatusEnum for code: " + code);
    }
}
